#ifndef MCOLOR_H
#define MCOLOR_H

#include "mconfig.h"
#ifdef GUI_APPLICATION

#include "type_def.h"

class MColorPrivate;

class MColor
{
	public:
		inline MColor() :
			_red(0), _green(0), _blue(0) {}

		inline MColor(muint8 red, muint8 green, muint8 blue) :
			_red(red), _green(green), _blue(blue) {}

		inline MColor(const MColor &other) :
			_red(other._red), _green(other._green), _blue(other._blue) {}

	public:
		inline muint8 red() const { return _red; }
		inline muint8 green() const { return _green; }
		inline muint8 blue() const { return _blue; }

		inline muint32 data() const
		{ return (_red << 16) | (_green<<8) | _blue; }

	public:
		inline void setRed(muint8 red) { _red = red; }
		inline void setGreen(muint8 green) { _green = green; }
		inline void setBlue(muint8 blue) { _blue = blue; }
		void set(muint8 red, muint8 green, muint8 blue);

	public:
		void flip();
		MColor Opposite() const;
		static MColor Opposite(const MColor &color);

		muint32 brightness() const;
		static muint32 brightness(const MColor &color);

	public:
		const MColor &operator=(const MColor &other);

		inline bool operator==(const MColor &other) const
		{ return _red == other._red and _green == other._green and _blue == other._blue; }

		inline bool operator!=(const MColor &other) const
		{ return _red != other._red or _green != other._green or _blue != other._blue; }

	private:
		muint32 _red;
		muint32 _green;
		muint32 _blue;
};


#endif //GUI_APPLICATION

#endif //MCOLOR_H
